/*
 * Tencent is pleased to support the open source community by making
 * MMKV available.
 *
 * Copyright (C) 2018 THL A29 Limited, a Tencent company.
 * All rights reserved.
 *
 * Licensed under the BSD 3-Clause License (the "License"); you may not use
 * this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 *       https://opensource.org/licenses/BSD-3-Clause
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.tencent.mmkv;


import ohos.utils.Parcel;
import ohos.utils.Sequenceable;

import java.util.List;

public class TestParcelable implements Sequenceable {

    public int iValue;
    public String sValue;
    public List<FakeInfo> list;


    public TestParcelable(int i, String s) {
        iValue = i;
        sValue = s;
        // list = new LinkedList<>();
        // list.add(new Info("channel", 1));
        // list.add(new Info("oppo", 2));
    }

    private TestParcelable(Parcel in) {
        iValue = in.readInt();
        sValue = in.readString();
        list = in.readSequenceableList(FakeInfo.class);
    }

    public static final Producer<TestParcelable> CREATOR = new Producer<TestParcelable>() {
        @Override
        public TestParcelable createFromParcel(Parcel parcel) {
            return new TestParcelable(parcel);
        }
//        @Override
//        public Sequenceable createFromParcel(Parcel parcel) {
//            return new TestParcelable(parcel);
//        }
//
//        @Override
//        public TestParcelable[] newArray(int i) {
//            return new TestParcelable[i];
//        }
    };

    @Override
    public boolean marshalling(Parcel parcel) {
        parcel.writeInt(iValue);
        parcel.writeString(sValue);
        return false;
    }

    @Override
    public boolean unmarshalling(Parcel parcel) {
        return false;
    }
}
